<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>26_this的介绍</title>
</head>

<body>
    <script>
        var name = "张三"
        function test(a, b) {
            alert(this.name + "_" + a + "_" + b)
        }
        // test() // window.test() 张三
        var obj = {
            name: "李四"
        }
        // test.call(obj, 1, 2) // 改变this指向并执行这个函数
        // test.apply(obj, [1,2]) // 改变this指向并执行这个函数
        const func = test.bind(obj)
        func()
    </script>
</body>

</html>